﻿using Esint.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace WebJudicialAuction.admin.handler
{
    /// <summary>
    /// FileDownload 的摘要说明
    /// </summary>
    public class FileDownload : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            string strFileName = context.Request["fileName"];

            if (string.IsNullOrWhiteSpace(strFileName))
            {
                context.Response.Write("未知错误");
            }
            else
            {
                string url = CommonExtend.GetAppSetting("DownloadPath") + strFileName;

                CommonExtend.DownloadFile(context, url, $"排班导出_{DateTime.Now.ToString("yyyyMMdd_HHmmss")}.xlsx");
            }
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}